package cn.tedu.boot01.controller;

import cn.tedu.boot01.entity.Emp;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.security.spec.RSAOtherPrimeInfo;

@RestController
public class ParamController {
    @RequestMapping("/p1")
    public String p1(HttpServletRequest request){
        String name=request.getParameter("name");
        String age=request.getParameter("age");
        return "测试1成功name="+name+",age="+age;
    }

    @RequestMapping("/p2")
    public String p2(String name,int age){
        return "测试2成功name="+name+",age="+age;
    }

    @RequestMapping("/p3")
    public String p3(Emp emp){
        System.out.println("emp = " + emp);
        return  emp.toString();
    }
}
